<!doctype html>
<html class="no-js">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>让租房更简单</title>
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  
  <link rel="stylesheet" href="/addons/yuzubang_1/template/mobile/css/amazeui.min.css">
  <script src="/addons/yuzubang_1/template/mobile/js/jquery.min.js"></script>
  <script src="/addons/yuzubang_1/template/mobile/js/amazeui.min.js"></script>
  <link rel="stylesheet" href="/addons/yuzubang_1/template/mobile/css/app.css">
</head>
<body>
<!-- Header -->
<header data-am-widget="header" class="am-header am-header-default">
	  <h1 class="am-header-title">
	    <a href="#title-link">房源列表</a>
	  </h1>
</header>

<div style='padding:10px; overflow:hidden;background-color: #ececeb;'>
	<div class='search_div am-cf' style="overflow:hidden;border: 1px solid #ececeb; border-radius: 20px;" >
		<div class='am-u-12'>
			<input id='search_keyword'  type='text' class='am-fl am-form-field' placeholder='输入要搜索的小区名' />
			<button class="am-fl am-btn am-btn-default" id='search_btn' onclick="select_search();">
			  <i class="am-icon-search"></i>
			</button>
		</div>
	</div>
</div>
	
<div>
	<nav data-am-widget="menu" class="am-menu am-menu-default condition_nav"> 
    <a href="javascript: void(0)" class="am-menu-toggle">
     	<i class="am-menu-toggle-icon am-icon-bars"></i>
    </a>

      <ul class="am-menu-nav am-avg-sm-3 condition_ul">
          <li class="am-parent">
            <a href="#" class="" >租金</a>
              <div class="am-menu-sub am-collapse am-avg-sm-3 rental_div" style='background-color:#f1f1f1;'>
              	<div class='rental_item rental_item_on' onclick="select_rental('', '', this);">不限</div>
              	<div class='rental_item' onclick="select_rental('0', '500', this);">500元/月以下</div>
              	<div class='rental_item' onclick="select_rental('500', '1000', this);">500-1000元/月</div>
              	<div class='rental_item' onclick="select_rental('1000', '2000', this);">1000-2000元/月</div>
              	<div class='rental_item' onclick="select_rental('2000', '3000', this);">2000-3000元/月</div>
              	<div class='rental_item' onclick="select_rental('3000', '5000', this);">3000-5000元/月</div>
              	<div class='rental_item' onclick="select_rental('5000', '8000', this);">5000-8000元/月</div>
              	<div class='rental_item' onclick="select_rental('8000', '', this);">8000元/月以上</div>
              </div>
          </li>
          <li class="am-parent">
            <a href="#" class="" >类型</a>
              <div class="am-menu-sub am-collapse am-avg-sm-4 renttype_div" style='background-color:#f1f1f1;'>
              	<div class='renttype_item' onclick="select_renttype('', this);">不限</div>
              	<div class='renttype_item' onclick="select_renttype('0', this);">整租</div>
              	<div class='renttype_item' onclick="select_renttype('1', this);">单间</div>
              </div>
          </li>
      </ul>
  	</nav>
</div>

<div style='padding:0 10px; overflow:hidden;margin-bottom: 60px;'>
	<div id='wlist_content'>
	</div>
	<input type="hidden" naem="rent" class="rent_div" value="{$rent}"/>
	<p style="padding: 0 5%;">
		<button id='btn_more' type="button" class="am-btn am-btn-default am-radius am-btn-block" style='font-size:1.4rem;width: 100%;text-align: center;background-color: white;border: 1px solid #fb4b00;border-radius: 20px;color: #fb4b00;' page='1'>加载更多</button>
	</p>	
</div>

<script>
	var p = 1;
	var search = rental1 = rental2 = rent_type = '';
	rent_type = $(".rent_div").val();

	$(function(){

		get_house_list(0);
		
		$('#btn_more').on('click', function(){
			p = parseInt($(this).attr('page'));
			get_house_list(1);
		});
	});

	function get_house_list(t){
		p = p || 1;
		$.post("{php echo $this->createMobileUrl('house', array('op'=>'get_list'));}", {
			'p':p,
			'search':search,
			'rental1':rental1,
			'rental2':rental2,
			'rent_type':rent_type
			}, 
		function(result){
			if(result.status==1){
				if(t==1){
					$('#wlist_content').append(result.data);	
				}else{
					$('#wlist_content').html(result.data);
				}
				if(result.count>0){
					$('#btn_more').attr('page', p+1);
				}else{
					$('#btn_more').hide();
				}
			}else{
				mz_alert(result.info);
			}
		}, 'json');					
	}

	function select_rental(r1, r2, obj){
		rental1 = r1;
		rental2 = r2;
		$('.rental_div .rental_item').removeClass('rental_item_on');
		$(obj).addClass('rental_item_on');
		$('div.am-menu-sub').removeClass('am-in');
		get_house_list(0);
	}
	function select_renttype(t, obj){
		rent_type = t;
		$('.renttype_div .renttype_item').removeClass('renttype_item_on');
		$(obj).addClass('renttype_item_on');
		$('div.am-menu-sub').removeClass('am-in');
		get_house_list(0);
	}
	function select_search(){
		search = $.trim($('#search_keyword').val());
		get_house_list(0);
	}
</script>

<div style="width: 100%;overflow: hidden;clear: both;text-align: center;padding-bottom: 5px;position: fixed;bottom: 0;background-color: #f8f8f8; border-top:1px solid #9f9f9f;">
	<a href="{php echo $this->createMobileUrl('index');}" style="width: 50%;float: left;display: block;font-size: 12px;color: #fb4b00;"><div class="foot_home_cur"></div>首页</a>

	<a href="{php echo $this->createMobileUrl('house');}" style="width: 50%;float: left;display: block;font-size: 12px;color: #fb4b00;"><div class="foot_house_cur"></div>找房</a>

</div>

<div class="am-modal am-modal-alert" tabindex="-1" id="mz_alert">
  <div class="am-modal-dialog">
    <div class="am-modal-hd"></div>
    <div class="am-modal-bd">
    </div>
    <div class="am-modal-footer">
      <span class="am-modal-btn">确定</span>
    </div>
  </div>
</div>

<div class="am-popup" id="mz_popup">
  <div class="am-popup-inner">
    <div class="am-popup-hd">
      <h4 class="am-popup-title">...</h4>
      <span data-am-modal-close
            class="am-close">&times;</span>
    </div>
    <div class="am-popup-bd">
      ...
    </div>
  </div>
</div>


<script src="/addons/yuzubang_1/template/mobile/js/app.js"></script>
</body>
</html>
